VERSION 5.00
Begin VB.Form frmNewServer 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   2625
   ClientLeft      =   45
   ClientTop       =   45
   ClientWidth     =   9915
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2625
   ScaleWidth      =   9915
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   WindowState     =   2  'Maximized
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Height          =   495
      Left            =   2760
      TabIndex        =   7
      Top             =   2280
      Width           =   1215
   End
   Begin VB.CommandButton cmdOk 
      Default         =   -1  'True
      Height          =   495
      Left            =   1320
      TabIndex        =   6
      Top             =   2280
      Width           =   1215
   End
   Begin VB.TextBox txtPort 
      Height          =   1005
      Left            =   7560
      TabIndex        =   4
      Top             =   720
      Width           =   2295
   End
   Begin VB.TextBox txtHost 
      Height          =   1005
      Left            =   4320
      TabIndex        =   2
      Top             =   720
      Width           =   2295
   End
   Begin VB.TextBox txtName 
      Height          =   1005
      Left            =   720
      TabIndex        =   0
      Top             =   720
      Width           =   2295
   End
   Begin VB.Label lblPort 
      Caption         =   "&Port:"
      Height          =   495
      Left            =   6840
      TabIndex        =   5
      Top             =   720
      Width           =   2415
   End
   Begin VB.Label lblHost 
      Caption         =   "&Host:"
      Height          =   495
      Left            =   3240
      TabIndex        =   3
      Top             =   720
      Width           =   2415
   End
   Begin VB.Label lblName 
      Caption         =   "&Name:"
      Height          =   495
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Width           =   2415
   End
End
Attribute VB_Name = "frmNewServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public PrevContent As String

' 0: normal, 1: edit
Public smode As Byte


Private Sub cmdCancel_Click()
Me.Hide
smode = 0
PrevContent = ""
Unload Me
FrmServerList.Show vbModal, frmMain




End Sub

Private Sub cmdOK_Click()
Dim sxc As Integer
Dim SString As String
IM.FileName = ServerListFile

TxtName.Text = Trim(TxtName.Text)
txtHost.Text = Trim(txtHost.Text)

If TxtName.Text = "" Then
MsgBox lang.Messages(35), vbCritical + vbOKOnly, lang.Messages(20)
If Me.ActiveControl.Name <> TxtName.Name Then TxtName.SetFocus
Exit Sub
ElseIf txtHost.Text = "" Then
MsgBox lang.Messages(36), vbCritical + vbOKOnly, lang.Messages(20)
Exit Sub
ElseIf txtPort.Text = "" Then
MsgBox lang.Messages(37), vbCritical + vbOKOnly, lang.Messages(20)
Exit Sub
End If

If ArrayInitialised(ArrPtr(servers)) Then
For sxc = 0 To UBound(servers)
If (LCase(TxtName.Text) = LCase(servers(sxc).sName)) And (LCase(TxtName.Text) <> LCase(PrevContent)) Then
MsgBox lang.Messages(90), vbOKOnly + vbCritical, lang.Messages(20)
TxtName.SetFocus
Exit Sub
End If
Next sxc
End If

SString = "Host=" & txtHost.Text & Chr$(0)
SString = SString & "Port=" & CStr(txtPort.Text) & Chr$(0) & Chr$(0)

If smode = 1 Then
If PrevContent <> TxtName.Text Then
IM.DelSection PrevContent
End If
End If
smode = 0
IM.WriteSection TxtName.Text, SString


LoadServerList (ServerListFile)
FrmServerList.AddServers
FrmServerList.LstServers.ListIndex = 0

Unload Me
FrmServerList.Show vbModal, frmMain



End Sub


Private Sub Form_Load()
lblName.Caption = lang.Messages(32)
lblHost.Caption = lang.Messages(33)
lblPort.Caption = lang.Messages(34)
cmdOk.Caption = lang.Buttons(2)
cmdCancel.Caption = lang.Buttons(3)
If smode = 0 Then
Me.Caption = lang.Messages(68)
txtPort.Text = "6667"
Else
Me.Caption = SPrintF(lang.Messages(92), PrevContent)
End If

End Sub





Private Sub txtPort_keypress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And (KeyAscii <> 8) Then
beep
KeyAscii = 0
End If
End Sub

